package com.baizhi.zjs.action;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.baizhi.zjs.service.ShopingCAtSerivceImpl;
import com.baizhi.zjs.service.ShopingCAtService;
import com.opensymphony.xwork2.ActionSupport;

public class ShopingCatAction extends ActionSupport{
	
	//获取图书id
	private String id;
	//获取前台图书数量
	private Integer count;
	//添加图书到购物车
public String  addShoping(){
	ShopingCAtSerivceImpl impl = new ShopingCAtSerivceImpl();
	impl.addShop(id);
	return "ShopCat";
}
//删除商品（将商品的状态修改为0）
public String delectShopCatBook(){
	//测试删除Action是否获取id
	System.out.println("测试删除Action是否获取id");
	System.out.println(id);
	ShopingCAtService impl = new ShopingCAtSerivceImpl();
	//将参数传到service层
	impl.deleteShopBook(id);
	return "ShopCat";
}

//恢复商品（将商品的状态修改为1）
public String recoverBook(){
	//测试删除Action是否获取id
		System.out.println("测试恢复Action是否获取id");
		System.out.println(id);
		ShopingCAtService impl = new ShopingCAtSerivceImpl();
		//将参数传到service层
		impl.recoverBook(id);
		return "ShopCat";
}
//修改购买数量
public String updateCount(){
	System.out.println("修改购买数量================");
	System.out.println(id+"============"+count);
	ShopingCAtSerivceImpl impl = new ShopingCAtSerivceImpl();
	impl.updateBook(id, count);
	return "ShopCat";
}

public String getId() {
	return id;
}
public void setId(String id) {
	this.id = id;
}
public Integer getCount() {
	return count;
}
public void setCount(Integer count) {
	this.count = count;
}


}
